babl: add matrix re-equalization
authorØyvind Kolås <pippin@gimp.org>
Mon, 18 Sep 2017 17:17:56 +0000 (19:17 +0200)
committerØyvind Kolås <pippin@gimp.org>
Mon, 18 Sep 2017 17:17:59 +0000 (19:17 +0200)
commitd730e96b6ed75275911de8b02fc9e6d725198e13
tree0820d8fb2ef03bad0f652eae2d4651ca8998a79d
parentc82c41eb07a5a2a4bad539fa4fdc7a8278caedc5
babl: add matrix re-equalization

This optimizes the coefficients of the matrix ensuring that a RGB 1.0 1.0 1.0
results in exactly CIE Lab 100.0 0.0 0.0 and that equal R,G,B triples yield 0.0
for CIE a, b. This is achieved by rounding to 16.16 fixed point precision,
which can be exactly represented by IEEE double, and then brute-force jittering
the coefficients +/- 1 for the best solution. This is also the rounding needed
for making the matrix well behaved when used in an ICC profile.
babl/babl-space.c